package com.example.sulei.rootchangerinfo.hook;

import android.os.Build;
import android.util.Log;

import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/**
 * Created by Sulei on 2017/4/17.
 */

public class BuildHook extends BaseHook {

    @Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
        //这里测试Hook静态变量,修改手机机型和厂商
//        XposedHelpers.setStaticObjectField(android.os.Build.class, "MANUFACTURER", "XiaoMI");//厂商
//        XposedHelpers.setStaticObjectField(android.os.Build.class, "MODEL", "XX011");//机型
        XposedHelpers.setStaticObjectField(XposedHelpers.findClass("android.os.Build", loadPackageParam.classLoader), "BRAND", "XiaoMi");//品牌
        XposedHelpers.setStaticObjectField(XposedHelpers.findClass("android.os.Build", loadPackageParam.classLoader), "MODEL", "iPhone 7 Plus");//品牌
        Log.d("pre", "handleLoadPackage() returned 品牌: " + Build.BRAND + "\n型号：" + Build.MODEL);

    }
}
